package l6;

import java.util.Scanner;
import java.util.Stack;

public class jzzh {
    static Stack<Integer> stack = new Stack<>();
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("请输入十进制数");
        int N=sc.nextInt();

        if (N==0){
            System.out.println(0);
            return;
        }

        while (N!=0){
            int mod=N%16;
            stack.push(mod);
            N=N/16;
        }

        System.out.println("十六进制为");
        while (!stack.isEmpty()) {
            if (stack.peek() >= 10) {
                System.out.printf("%c", stack.pop()-10+'A');
            } else {
                System.out.print(stack.pop());
            }
        }
    }
}
